/*
 * This file is part of aion-unique <aion-unique.org>.
 *
 *  aion-unique is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  aion-unique is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with aion-unique.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.aionengine.gameserver.model.templates.tribe;

import com.aionengine.gameserver.model.TribeClass;

import javax.xml.bind.annotation.*;
import java.util.Collections;
import java.util.List;

/**
 * @author ATracer
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Tribe")
public class Tribe {

    @XmlList
    protected List<TribeClass> aggro;
    @XmlList
    protected List<TribeClass> hostile;
    @XmlList
    protected List<TribeClass> friend;
    @XmlList
    protected List<TribeClass> neutral;
    @XmlList
    protected List<TribeClass> none;
    @XmlList
    protected List<TribeClass> support;

    @XmlAttribute
    protected TribeClass base = TribeClass.NONE;

    @XmlAttribute(required = true)
    protected TribeClass name;

    public List<TribeClass> getAggro() {
        if (aggro == null) {
            aggro = Collections.emptyList();
        }
        return this.aggro;
    }

    public List<TribeClass> getHostile() {
        if (hostile == null) {
            hostile = Collections.emptyList();
        }
        return this.hostile;
    }

    public List<TribeClass> getFriend() {
        if (friend == null) {
            friend = Collections.emptyList();
        }
        return this.friend;
    }

    public List<TribeClass> getNeutral() {
        if (neutral == null) {
            neutral = Collections.emptyList();
        }
        return this.neutral;
    }

    public List<TribeClass> getNone() {
        if (none == null) {
            none = Collections.emptyList();
        }
        return this.none;
    }

    public List<TribeClass> getSupport() {
        if (support == null) {
            support = Collections.emptyList();
        }
        return this.support;
    }

    public TribeClass getBase() {
        return base == TribeClass.NONE ? name : base;
    }

    public TribeClass getName() {
        return name;
    }

    public final boolean isGuard() {
        return name.isGuard();
    }

    public final boolean isBasic() {
        return name.isBasicClass();
    }

    @Override
    public String toString() {
        return name + " (" + base + ")";
    }
}
